package org.example.my_netty.boss;


import org.example.my_netty.myNettyHandlerChain.MyNettyHandler;
import org.example.my_netty.worker.MyWorkerGroup;

//工作池 里面是多个worker 对标线程池里面的线程
public class MyBossGroup {

    //不想管这个的多个模式了 在worker实现了
    private final MyBoss boss=new MyBoss();


    //实质上是没有用的
    private MyWorkerGroup workerGroup;

    //给boss设置workerGroup
    public void setWorkerGroup(MyWorkerGroup workerGroup) {
        this.workerGroup = workerGroup;
        boss.setWorkerGroup(workerGroup);
    }


    //启动
    public void start(int port) {

        boss.start(port);

    }


    //给worker添加handler
    public void addWorkerHandler(MyNettyHandler myNettyHandler) {
        workerGroup.addHandler(myNettyHandler);
    }
}
